package numWays;

public class Solution {
    // 滚动数组
    public int numWays(int n) {
        if(n<=2){
            return n;
        }
        final int MOD = 1000000007;
        int p = 0,q = 1, r = 2;

        for (int i = 3; i <= n ; i++) {
            p = q;
            q = r;
            r = (p+q)%MOD;
        }
        return r;
    }
}
